package com.panshi;


import com.panshi.api.util.PageSizeVO;
import com.panshi.bean.AnswerBean2;
import com.panshi.bean.AnswerComBean;
import com.panshi.bean.AnswerNoBean;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;

@FeignClient(name = "answer-service-eureka", path = "ans")
@Component
public interface AnswerApi {
    @PostMapping("/initAnswer")
    @ApiOperation("用户回答某个问题")
    public int initAnswer(@RequestBody AnswerNoBean ansNo);

    @PostMapping("/uploadImg")
    @ApiOperation("图片上传")
    public String uploadImg(@RequestParam("file") MultipartFile file);

    @GetMapping("/deleteAnswer")//问题表回答数减1,回答表的该回答状态伪删除(需判断审核状态，觉得去审核表还是答案表),回答表下的评论表和点赞表
    @ApiOperation("用户删除某问题的回答(当state为0删除问题表，1删除未审核表)")
    public int deleteAnswer(@RequestBody AnswerBean2 answer);

    @GetMapping("/openCom")
    @ApiOperation("用户点击某个回答打开回复")
    public List<AnswerComBean> openCom(@RequestParam int aid, @RequestParam int pid);


    @PostMapping("/updateAnswer")
    @ApiOperation("用户修改回答")
    public int updateAnswer(@RequestBody AnswerBean2 answer);


    @GetMapping("/clientLike")
    @ApiOperation("用户给回答点赞or点踩")
    public String clientLike(@RequestParam int aaid, @RequestParam int uid, @RequestParam int type);




    //管理员接口==========================================================================================================
    @PostMapping("/adminFindAnswer")
    @ApiOperation("管理员查询回答表")
    public PageSizeVO<List<AnswerBean2>> adminFindAnswer(@RequestBody PageSizeVO pageSizeVO);


    @PostMapping("/adminFindAnswerNo")
    @ApiOperation("管理员查询回答审核表")
    public PageSizeVO<List<AnswerNoBean>> adminFindAnswerNo(@RequestBody PageSizeVO pageSizeVO);

    @PostMapping("/adminInitAnswer")
    @ApiOperation("审核表回答进入回答表")
    public int adminInitAnswer(@RequestBody AnswerNoBean answer) throws Exception;

    @GetMapping("/adminUpdateQaAnswer")
    @ApiOperation("管理员修改回答表")
    public int adminUpdateQaAnswer(@RequestParam int state,@RequestParam int aaid,@RequestParam int uid) throws Exception;

    @PostMapping("/adminAnswerNo")
    @ApiOperation("管理员修改审核表")
    public int adminAnswerNo(@RequestBody AnswerNoBean answer) throws Exception;
}
